#ifndef VECTOR_C
#define VECTOR_C

#include "vector.h"


double  dot(Vector v1, Vector v2) {
  return (v1.x * v2.x) + (v1.y * v2.y) + (v1.z * v2.z);
};

double  magnitude(Vector v1) {
  double d, s;
  d =  dot(v1, v1);
  s = sqrt(d);
  return s;
};

Vector  add(Vector v1, Vector v2) {
  Vector v;
  v.x = v1.x + v2.x;
  v.y = v1.y + v2.y;
  v.z = v1.z + v2.z;
  return v;
};

Vector  sub(Vector v1, Vector v2) {
  Vector v;
  v.x = v1.x - v2.x;
  v.y = v1.y - v2.y;
  v.z = v1.z - v2.z;
  return v;
};

Vector  scale(Vector v1, double f) {
  Vector v;
  v.x = v1.x * f;
  v.y = v1.y * f;
  v.z = v1.z * f;
  return v;
};

Vector cross(Vector v1, Vector v2) {
  Vector v;
  v.x = v1.y * v2.z - v1.z * v2.y;
  v.y = v1.z * v2.x - v1.x * v2.z;
  v.z = v1.x * v2.y - v1.y * v2.x;
  return v;
};

Vector normalized(Vector v1){
  Vector v;
  v =  scale(v1, 1.0 /  magnitude(v1));
  return v;
};

Vector negated(Vector v1){
  Vector v;
  v =  scale(v1, -1);
};

bool equal(Vector v1, Vector v2){
  return (v1.x == v2.x)  && 
    (v1.y == v2.y)  && 
    (v1.z == v2.z) ;
    
};

Vector reflectThru(Vector v, Vector n){
  Vector sb;
  sb =  sub(v,  scale( scale(n,  dot(v, n)), 2.0));
  return sb;
};


#endif
